package com.my.controller;

import com.my.bean.User;
import com.my.service.TextService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.Arrays;
import java.util.List;

@Controller
public class TextController {

  @Autowired
  TextService TextService;


  @RequestMapping({"/text1"})
  @ResponseBody
   public List text1(){

    return TextService.text1();
  }
  @RequestMapping({"/text"})
  @ResponseBody
  public List text2(){
    try {
      List<User> getuser = TextService.getuser();
      return getuser;
    }catch (Exception e){
      System.out.println(e);
      return Arrays.asList("hello","text");
    }

  }





}
